home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / arch / x86 / kernel / cpu / mkcapflags.pl < prev   
Encoding:
Perl Script  |  2008-12-24  |  700 b   |  33 lines

  1. #!/usr/bin/perl
  2. #
  3. # Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h
  4. #
  5.  
  6. ($in, $out) = @ARGV;
  7.  
  8. open(IN, "< $in\0")   or die "$0: cannot open: $in: $!\n";
  9. open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
  10.  
  11. print OUT "#include <asm/cpufeature.h>\n\n";
  12. print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
  13.  
  14. while (defined($line = <IN>)) {
  15.     if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) {
  16.         $macro = $1;
  17.         $feature = $2;
  18.         $tail = $3;
  19.         if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) {
  20.             $feature = $1;
  21.         }
  22.  
  23.         if ($feature ne '') {
  24.             printf OUT "\t%-32s = \"%s\",\n",
  25.                 "[$macro]", "\L$feature";
  26.         }
  27.     }
  28. }
  29. print OUT "};\n";
  30.  
  31. close(IN);
  32. close(OUT);
  33.